<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="jquery-1.8.3.js" type="text/javascript"></script>
<script src="jquery.uploadifive.js" type="text/javascript"></script>
<link href="uploadifive.css" type="text/css" rel="stylesheet" />
<body>
	<form class="cd-form" id="subForm" action="openaccount" method="post">
		<div id="cd-signup">
			<p class="fieldset">
				<label class="image-replace cd-photo1" for="signup-idimage1"></label>
				<input class="full-width has-padding has-border"
					id="signup-idimage1" type="file" name="upload"
					style=""
					> <input
					type="hidden" name="frontSide" id="frontSide">
			<div id="tip-queue1"></div>
			</p>
			</p>
			<p class="fieldset">
				<input class="full-width2" id="submit" type="submit" value="提交">
			</p>
	</form>
<a href="javascript:$('#signup-idimage1').uploadifive('upload')">上传文件</a> |
 <a href="javascript:$('#signup-idimage1').uploadifive('stop')">停止上传!</a>
	<script>  
   $(function() {
    $('#signup-idimage1').uploadifive({
        'auto' : true,
		 'dnd': false,
		 'height'          : 200, 
		 'width'           : 400,
        'uploadScript' : 'uploadPhoto',
        'fileObjName' : 'upload',
        'buttonText' : '上传照片',
        'queueID' : 'tip-queue1',
        'fileType' : 'image/*',
        'multi' : true,
        'fileSizeLimit'   : 5242880,
        'uploadLimit' : 1,
        'queueSizeLimit'  : 1,   
        'onUploadComplete' : function(file, data) {
            var obj = JSON.parse(data);
            if (obj.img == "500") {
                alert("系统异常！");
            } else {
                $("#frontSide").val(obj.img);
                document.getElementById("submit").disabled = false;
            }
        },
        onCancel : function(file) {
           $("#frontSide").val("");
            /* 注意：取消后应重新设置uploadLimit */
            $data    = $(this).data('uploadifive'),
            settings = $data.settings;
            settings.uploadLimit++;
            alert(file.name + " 已取消上传~!");
        },
        onFallback : function() {
            alert("该浏览器无法使用!");
        },
        onUpload : function(file) {
            document.getElementById("submit").disabled = true;//当开始上传文件，要防止上传未完成而表单被提交
        },
    });
});
   </script>
</body>
</html>